package day_240524;

import java.util.ArrayList;
import java.util.Collection;

@SuppressWarnings("all")
public class CollectionCommonMethod {
    public static void main(String[] args) {
        Collection<String> al1 = new ArrayList<>();
        al1.add("xyz");
        al1.add("abc");
        al1.add(new String("123"));

        System.out.println(al1.contains("123"));

        System.out.println("=== === ===");

        Collection<Student> al2 = new ArrayList<>();
        al2.add(new Student("S1",12));
        al2.add(new Student("S2",13));
        al2.add(new Student("S3",14));

        System.out.println(al2.contains(new Student("S3",14)));
    }


}
// Java bean
class Student{
    String name;
    int age;

    public Student(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}